JS の Array.prototype.findIndex()
https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex
code:ts
const array = 5, 12, 8, 130, 44;
const isLarge = (num: number) => num > 13;
console.log(array.findIndex(isLarge));
findIndex() は Arrary インスタンスのメソッド
配列内の指定したテスト関数(boolean を返す?)を最初に満足する index を返す
まだ言語化できていないけど、要素がプリミティブではなくてオブジェクトの場合にあは findIndex() を使用するのがよさそう
JavaScirpt TypeScript